﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Blogs
{
    public partial class LogIn : Form
    {
        public LogIn()
        {
            InitializeComponent();
        }
        public static Dictionary<string, string> user = new Dictionary<string, string>();
        private void button1_Click(object sender, EventArgs e)
        {
            var userName = textBox1.Text;
            var password = textBox2.Text;

            var sql = string.Format("select * from Users where Username ={0} and  Passward={1}", userName, password);

            var dt = DbHelper.GetDate(sql);
            if(dt.Rows.Count == 1)
            {
                DialogResult dr = MessageBox.Show("登录成功，等待跳转", "登录成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MainInterface mainInterface = new MainInterface();
                this.Hide();
                mainInterface.Show();
            }
            else
            {
                DialogResult ds = MessageBox.Show("用户名或密码错误！", "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }






        }

        private void button2_Click(object sender, EventArgs e)
        {
            Enroll enroll = new Enroll();
            this.Hide();
            enroll.Show();
        }
    }
}
